<?php

namespace Platform\Models\Organize;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class LeaderOperationLog extends Model
{

    protected $table = 'organize_leader_operation_log';
    protected $guarded = [];

    /**
     * 绑定组织成员的关系
     * @return BelongsTo
     */
    public function leader() : BelongsTo
    {
        return $this->belongsTo(Leader::class,'leader_id','id')->withTrashed();
    }

    /**
     * 绑定组织的关系
     * @return BelongsTo
     */
    public function organize() : BelongsTo
    {
        return $this->belongsTo(Organize::class)->withTrashed();
    }

    /**
     * 获取input 字段值时，格式化input字段值
     * @param $value
     * @return mixed
     */
    public function getInputAttribute($value)
    {
        return json_decode($value,1);
    }

}
